<?php
namespace app\api\controller;

use think\Controller;
use app\api\model\Category as CategoryModel;

/**
 * 商品分类
 *
 * Class Category
 * @package app\api\controller
 */
class Category extends Common
{
    /**
     * 获取所有分类
     * @return array|\PDOStatement|string|\think\Collection
     * @throws \app\lib\exception\ThrowError
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getAllCategory()
    {
        $list = CategoryModel::getAllCategory();

        if ($list->isEmpty())
        {
            T(500000);
        }

        return $this->response($list);
    }
}
